<?php
include_once("../../../common/module/checkA.php");
include_once("../../../../config.php");
include_once("../controller/detail-statistic.php");
?>

<?$department_list=select_lines_all_items($table_Prefix."department","nid desc","","0");?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <?php include ROOT_PATH_.'/controller/common/module/head.php'; ?>
    <?php include 'modules/head.php'; ?>
</head>

<body class="finance">

<div id="topbar">   <?php include ROOT_PATH_.'/controller/common/module/topbar.php'; ?></div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/module/sidebar.php'; ?>
        </div>


<div id="content" class="layui-form">
<h1> 财务统计 </h1>



<div class="select-function">

    <div class="layui-form-item">
        <label class="layui-form-label">部门
        </label>
        <div class="layui-input-block">
            <select name="department" lay-search="">

                <option value="全选" >全选</option>



                <? for($i=0;$i<count($department_list);$i++){ ?>
                    <option value="<? echo $department_list[$i]['nid'] ?>"><? echo $department_list[$i]['nid'] ?> : <? echo $department_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
    </div>


    <div class="layui-form-item" >
        <label class="layui-form-label">时间段</label>
        <div class="layui-input-block">
            <input type="text" name="starttime" id="date" autocomplete="off" class="layui-input"  value="<? echo date("Y-m-d",strtotime("-1 day"))?>" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" class="laydate-icon">
        </div>

    </div>



    <div class="layui-form-item" >
        <label class="layui-form-label" style=" width:10px">-</label>
        <div class="layui-input-block" style="margin-left:45px; margin-right: 45px;">
            <input type="text" name="endtime" id="date" autocomplete="off" class="layui-input "  value="<? echo date("Y-m-d") ?>" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" class="">
        </div>
    </div>


    <br class="clearfloat"/>

<div class="functions">
    <button class="layui-btn">查询</button>
</div>
</div>




    <br class="clearfloat"/>




    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
<!--        <ul class="layui-tab-title">-->
<!--            <li class="layui-this">汇总</li>-->
<!---->
<!---->
<?//for($i=0;$i<count($department_list);$i++){?>
<!--<li >--><?// echo $department_list[$i]['name'];?><!--</li>-->
<?// ;} ?>
<!---->
<!--        </ul>-->
        <div class="layui-tab-content">


<!--tab开始-->
            <div class="layui-tab-item layui-show">
                <div class="layui-form list-box">


                    <h2>近7日统计</h2>
                    <table class="layui-table" >
                        <colgroup>
                            <col width="120px" >
                            <col >
                            <col >
                            <col >
                            <col>
                        </colgroup>
                        <thead>
                        <tr>
                            <th>日期</th>
                            <th>部门</th>
                            <th>总支出</th>
                            <th>总收入</th>
                            <th>收生费</th>
                            <th>收生</th>
                        </tr>
                        </thead>


                        <tbody>

                        <? for($i=0;$i<7;$i++){?>
                            <tr>
                                <td><?echo date("Y-m-d",strtotime("-$i day"))?></td>
                                <td>合计</td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and cost < 0 ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and cost > 0 ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and classify = '学费收款'")?></td>
                            </tr>
                        <?}?>


                        </tbody>


                    </table>





                    <h2>近12个月统计</h2>
                    <table class="layui-table" >
                        <colgroup>
                            <col >
                            <col >
                            <col >
                            <col >
                            <col>
                        </colgroup>
                        <thead>
                        <tr>
                            <th>日期</th>
                            <th>部门</th>
                            <th>总支出</th>
                            <th>总收入</th>
                            <th>收生费</th>
                            <th>收生</th>
                        </tr>
                        </thead>


                        <tbody>
                        <? for($i=0;$i<12;$i++){?>
                            <tr>
                                <td><?echo date("Y-m",strtotime("-$i month"))?></td>
                                <td>合计</td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m",strtotime("-$i month"))."%' and status = '生效' and cost < 0 ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m",strtotime("-$i month"))."%' and status = '生效' and cost > 0 ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m",strtotime("-$i month"))."%' and status = '生效' ")?></td>
                                <td><?echo sum_total($table_Prefix."finance","applydate like '".date("Y-m",strtotime("-$i month"))."%' and status = '生效' and classify = '学费收款'")?></td>
                            </tr>
                        <?}?>


                        </tbody>


                    </table>


<!---->
<!---->
<!---->
<!--                    <h2>本月部门招生排名</h2>-->
<!--                    <table class="layui-table" >-->
<!--                        <colgroup>-->
<!--                            <col >-->
<!--                            <col >-->
<!--                            <col >-->
<!--                            <col >-->
<!--                            <col>-->
<!--                        </colgroup>-->
<!--                        <thead>-->
<!--                        <tr>-->
<!--                            <th>日期</th>-->
<!--                            <th>部门</th>-->
<!--                            <th>总支出</th>-->
<!--                            <th>总收入</th>-->
<!--                            <th>收生费</th>-->
<!--                            <th>收生</th>-->
<!--                        </tr>-->
<!--                        </thead>-->
<!---->
<!---->
<!--                        <tbody>-->
<!---->
<!--                        --><?// for($i=0;$i<7;$i++){?>
<!--                            <tr>-->
<!--                                <td>--><?//echo date("Y-m-d",strtotime("-$i day"))?><!--</td>-->
<!--                                <td>合计</td>-->
<!--                                <td>--><?//echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and cost < 0 ")?><!--</td>-->
<!--                                <td>--><?//echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and cost > 0 ")?><!--</td>-->
<!--                                <td>--><?//echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' ")?><!--</td>-->
<!--                                <td>--><?//echo sum_total($table_Prefix."finance","applydate like '".date("Y-m-d",strtotime("-$i day"))."%' and status = '生效' and classify = '学费收款'")?><!--</td>-->
<!--                            </tr>-->
<!--                        --><?//}?>
<!---->
<!---->
<!--                        </tbody>-->
<!---->
<!---->
<!--                    </table>-->






                </div>

            </div>
<!--tab结束-->




            <div class="layui-tab-item">内容2</div>
            <div class="layui-tab-item">内容3</div>
            <div class="layui-tab-item">内容4</div>
            <div class="layui-tab-item">内容5</div>
        </div>
    </div>






<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>


<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?> </body>
</html>
